class Admin::SettingsController < AdminController
  def index
    @settings = Setting.all
  end

  def update
    @setting = Setting.find params[:id]
    if @setting.update setting_params
      redirect_to admin_settings_path, notice: "更新成功！"
    else
      redirect_to admin_settings_path, notice: "更新失败！"
    end
  end

  private

  def setting_params
    params.require(:setting).permit(:var, :value)
  end
end
